class_hint = XAllocClassHint();
class_hint->res_name = (char *) g_get_prgname ();
- class_hint->res_class = (char *)gdk_get_program_class ();
+ class_hint->res_class = (char *) g_get_prgname ();
/* XmbSetWMProperties sets the RESOURCE_NAME environment variable
* from argv[0], so we just synthesize an argument array here.
return display;
}
+/**
+ * gdk_x11_display_set_program_class:
+ * @display: a #GdkDisplay
+ * @program_class: a string
+ *
+ * Sets the program class.
+ *
+ * The X11 backend uses the program class to set the class name part
+ * of the `WM_CLASS` property on toplevel windows; see the ICCCM.
+ *
+ * Since: 3.94
+ */
+void
+gdk_x11_display_set_program_class (GdkDisplay *display,
+ const char *program_class)
+{
+ GdkX11Display *display_x11 = GDK_X11_DISPLAY (display);
+ XClassHint *class_hint;
+
+ g_free (display_x11->program_class);
+ display_x11->program_class = g_strdup (program_class);
+
+ class_hint = XAllocClassHint();
+ class_hint->res_name = (char *) g_get_prgname ();
+ class_hint->res_class = (char *) program_class;
+ XSetClassHint (display_x11->xdisplay, display_x11->leader_window, class_hint);
+ XFree (class_hint);
+}
+
/*
* XLib internal connection handling
*/
g_slice_free (GdkErrorTrap, trap);
}
+ g_free (display_x11->program_class);
+
G_OBJECT_CLASS (gdk_x11_display_parent_class)->finalize (object);
}
class_hint = XAllocClassHint ();
class_hint->res_name = (char *) g_get_prgname ();
- class_hint->res_class = (char *) gdk_get_program_class ();
+ class_hint->res_class = (char *) display_x11->program_class;
XSetClassHint (xdisplay, impl->xid, class_hint);
XFree (class_hint);
GDK_AVAILABLE_IN_ALL
void gdk_x11_display_set_startup_notification_id (GdkDisplay *display,
const gchar *startup_id);
+GDK_AVAILABLE_IN_3_94
+void gdk_x11_display_set_program_class (GdkDisplay *display,
+ const char *program_class);
GDK_AVAILABLE_IN_ALL
void gdk_x11_display_set_cursor_theme (GdkDisplay *display,